package gui;

import java.io.Serializable;

import org.primefaces.context.RequestContext;

/**
 * Bean for managing a progressbar
 * 
 * @author Aleksander Zotov
 * 
 */
public class ProgressbarBean implements Serializable {

	private static final long serialVersionUID = 1L;

	private Integer progress;

	/**
	 * Reads the CAT.exe execution progress and passes it to progressbar
	 * 
	 * @return progress
	 */
	public Integer getProgress() {
		if (progress == null) {
			progress = 0;
		} else {
			if (ListModel.getSelectedSimForPDF() != null) {
				progress = ListModel.getSelectedSimForPDF().getProgress();
				return progress;
			}
		}
		return 0;
	}

	public void setProgress(Integer progress) {
		this.progress = progress;
	}

	public void onComplete() {
	}
	
	public void cancel() {
		progress = null;
	}
}
